package com.yidu.BusinessData.controller;


import com.yidu.BusinessData.entity.BondEntity;
import com.yidu.BusinessData.service.BondService;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class BondController {

    @Resource
    private BondService bondService;


    @RequestMapping("/bondSelect")
    public Map bondSelect(String bondName,int page,int limit){
        System.out.println("mmmm");
        List<BondEntity> list = bondService.bondSelect(bondName,page, limit);
        int count = bondService.bondSelectCount();
        Map map =new HashMap();
        map.put("code",0);
        map.put("msg","");
        map.put("count",count);
        map.put("data",list);
        return map;
    }

    @RequestMapping("/bondInsert")
    public String bondInsert(BondEntity bond,String bondIdi){
        System.out.println(bondIdi+"是编号");
        bond.setBondId(bondIdi);
        bondService.bondInsert(bond);
        return "bondInsert";
    }

    @RequestMapping("/bondUpdate")
    public String bondUpdate(BondEntity bond){
        bondService.bondUpdate(bond);
        System.out.println(bond);
        return "bondUpdate";
    }

    @RequestMapping("/bondDelete")
    public String bondDelete(String bondId){
        bondService.bondDelete(bondId);
        System.out.println("dsddsddd"+bondId);
        return "bondDelete";
    }
    /*@RequestMapping("/bondSelectName")
    public List<BondEntity> bondSelectName(String bondName){
        List<BondEntity> bondEntities = bondService.bondSelectName("%" + bondName + "%");
        System.out.println("查询"+bondEntities);
        return bondEntities;
    }*/
}
